﻿// -----------------------------------------------------------------------
// <copyright file="IDirectoryInfo.cs" company="Company">
// Company 2011
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.AccessControl;

namespace Company.IO.Interfaces
{
    /// <summary>
    /// Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
    /// </summary>
    [Guid("586b9348-ed45-4046-aa65-8128d7ee652c")]
    public interface IDirectoryInfo : IFileSystemInfo
    {
        /// <summary>
        /// Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
        /// </summary>
        IDirectoryInfo Parent { [SecuritySafeCritical]
        get; }

        /// <summary>
        /// <para>
        /// Gets the root portion of a path.
        /// </para>
        /// </summary>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <return>
        /// <para>
        /// A DirectoryInfo object representing the root of a path.
        /// </para>
        /// </return>
        IDirectoryInfo Root { [SecuritySafeCritical]
        get; }

        /// <summary>
        /// <para>
        /// Creates a subdirectory or subdirectories on the specified path. 
        /// The specified path can be relative to this instance of the DirectoryInfo class.
        /// </para>
        /// </summary>
        /// <param name="path">
        /// <para>
        /// The specified path. This cannot be a different disk volume or Universal Naming Convention (UNC) name.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path does not specify a valid file path or contains invalid DirectoryInfo characters. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// path is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid, such as being on an unmapped drive.
        /// </para>
        /// </exception>
        /// <exception cref="IIIOException">
        /// <para>
        /// The subdirectory cannot be created.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// A file or directory already has the name specified by path.
        /// </para>
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// <para>
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters. 
        /// The specified path, file name, or both are too long.
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have code access permission to create the directory.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// The caller does not have code access permission to read the directory 
        /// described by the returned DirectoryInfo object. 
        /// This can occur when the path parameter describes an existing directory.
        /// </para>
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// <para>
        /// path contains a colon character (:) that is not part of a drive label ("C:\").
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// The last directory specified in path.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IDirectoryInfo CreateSubdirectory(string path);

        /// <summary>
        /// <para>
        /// Creates a subdirectory or subdirectories on the specified path with the specified security. 
        /// The specified path can be relative to this instance of the DirectoryInfo class.
        /// </para>
        /// </summary>
        /// <param name="path">
        /// <para>
        /// The specified path. This cannot be a different disk volume or Universal Naming Convention (UNC) name.
        /// </para>
        /// </param>
        /// <param name="directorySecurity">
        /// <para>
        /// The security to apply.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path does not specify a valid file path or contains invalid DirectoryInfo characters. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// path is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid, such as being on an unmapped drive.
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// The subdirectory cannot be created.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// A file or directory already has the name specified by path.
        /// </para>
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// <para>
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters. 
        /// The specified path, file name, or both are too long.
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have code access permission to create the directory.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// The caller does not have code access permission to read the directory 
        /// described by the returned DirectoryInfo object. 
        /// This can occur when the path parameter describes an existing directory.
        /// </para>
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// <para>
        /// path contains a colon character (:) that is not part of a drive label ("C:\").
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// The last directory specified in path.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IDirectoryInfo CreateSubdirectory(string path, DirectorySecurity directorySecurity);

        /// <summary>
        /// <para>
        /// Creates a directory.
        /// </para>
        /// </summary>
        /// <exception cref="IIOException">
        /// <para>
        /// The directory cannot be created. 
        /// </para>
        /// </exception>
        void Create();

        /// <summary>
        /// <para>
        /// Creates a directory using a DirectorySecurity object.
        /// </para>
        /// </summary>
        /// <param name="directorySecurity">
        /// <para>
        /// The access control to apply to the directory.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// path is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid, such as being on an unmapped drive.
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// The directory specified by path is read-only or is not empty. 
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// The directory specified by path is read-only or is not empty. 
        /// </para>
        /// </exception>
        /// <exception cref="IPathTooLongException">
        /// <para>
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters. 
        /// The specified path, file name, or both are too long.
        /// </para>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// <para>
        /// path contains a colon character (:) that is not part of a drive label ("C:\").
        /// </para>
        /// </exception>
        void Create(DirectorySecurity directorySecurity);

        /// <summary>
        /// <para>
        /// Gets a DirectorySecurity object that encapsulates the access control list 
        /// (ACL) entries for the directory described by the current DirectoryInfo object.
        /// </para>
        /// </summary>
        /// <exception cref="SystemException">
        /// <para>
        /// The directory could not be found or modified. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// An I/O error occurred while opening the directory. 
        /// </para>
        /// </exception>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters. 
        /// The specified path, file name, or both are too long.
        /// </para>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>
        /// The current process does not have access to open the directory.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// The directory is read-only.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// This operation is not supported on the current platform.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// <para>
        /// path contains a colon character (:) that is not part of a drive label ("C:\").
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// A DirectorySecurity object that encapsulates the access control rules for the directory.
        /// </para>
        /// </returns>
        DirectorySecurity GetAccessControl();

        /// <summary>
        /// <para>
        /// Gets a DirectorySecurity object that encapsulates the access control list 
        /// (ACL) entries for the directory described by the current DirectoryInfo object.
        /// </para>
        /// </summary>
        /// <param name="includeSections">
        /// <para>
        /// One of the AccessControlSections values that specifies the type of access control list (ACL) information to receive.
        /// </para>
        /// </param>
        /// <exception cref="SystemException">
        /// <para>
        /// The directory could not be found or modified. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// An I/O error occurred while opening the directory. 
        /// </para>
        /// </exception>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The specified path, file name, or both exceed the system-defined maximum length. 
        /// For example, on Windows-based platforms, paths must be less than 248 characters, 
        /// and file names must be less than 260 characters. 
        /// The specified path, file name, or both are too long.
        /// </para>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>
        /// The current process does not have access to open the directory.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// The directory is read-only.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// This operation is not supported on the current platform.
        /// </para>
        /// <para>
        /// - or -
        /// </para>
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// <para>
        /// path contains a colon character (:) that is not part of a drive label ("C:\").
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// A DirectorySecurity object that encapsulates the access control rules for the directory.
        /// </para>
        /// </returns>
        DirectorySecurity GetAccessControl(AccessControlSections includeSections);

        /// <summary>
        /// <para>
        /// Applies access control list (ACL) entries described by a DirectorySecurity 
        /// object to the directory described by the current DirectoryInfo object.
        /// </para>
        /// </summary>
        /// <param name="directorySecurity">
        /// <para>
        /// An object that describes an ACL entry to apply to the directory described by the path parameter
        /// </para>
        /// </param>
        /// <exception cref="SystemException">
        /// <para>
        /// The file could not be found or modified. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// The directorySecurity parameter is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="PlatformNotSupportedException">
        /// <para>
        /// The current operating system is not Microsoft Windows 2000 or later.
        /// </para>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>
        /// The current process does not have access to open the file.
        /// </para>
        /// </exception>
        [SecuritySafeCritical]
        void SetAccessControl(DirectorySecurity directorySecurity);

        /// <summary>
        /// <para>
        /// Returns a file list from the current directory.
        /// </para>
        /// </summary>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path is invalid, such as being on an unmapped drive.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of type FileInfo.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IFileInfo[] GetFiles();

        /// <summary>
        /// <para>
        /// Returns a file list from the current directory matching the given search pattern.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string, such as "*.txt".
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// searchPattern contains one or more invalid characters defined by the GetInvalidPathChars method. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path is invalid (for example, it is on an unmapped drive). 
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of type FileInfo.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IFileInfo[] GetFiles(string searchPattern);

        /// <summary>
        /// <para>
        /// Returns a file list from the current directory matching the given search pattern.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. For example, "System*" can be used to search for all directories that begin with the word "System".
        /// </para>
        /// </param>
        /// <param name="searchOption">
        /// <para>
        /// One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// searchPattern contains one or more invalid characters defined by the GetInvalidPathChars method. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// searchOption is not a valid SearchOption value. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path is invalid (for example, it is on an unmapped drive). 
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of type FileInfo.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IFileInfo[] GetFiles(string searchPattern, SearchOption searchOption);

        /// <summary>
        /// <para>
        /// Returns the subdirectories of the current directory.
        /// </para>
        /// </summary>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the DirectoryInfo object is invalid, such as being on an unmapped drive. 
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>
        /// The caller does not have the required permission. 
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of DirectoryInfo objects.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IDirectoryInfo[] GetDirectories();

        /// <summary>
        /// <para>
        /// Returns an array of directories in the current DirectoryInfo matching the given search criteria.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. For example, "System*" can be used to search for all directories that begin with the word "System".
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// searchPattern contains one or more invalid characters defined by the GetInvalidPathChars method. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path is invalid (for example, it is on an unmapped drive). 
        /// </para>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of type DirectoryInfo matching searchPattern.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IDirectoryInfo[] GetDirectories(string searchPattern);

        /// <summary>
        /// <para>
        /// Returns an array of directories in the current DirectoryInfo matching 
        /// the given search criteria and using a value to determine whether to search subdirectories.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. For example, "System*" can be used to search for all directories that begin with the word "System".
        /// </para>
        /// </param>
        /// <param name="searchOption">
        /// <para>
        /// One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// searchPattern contains one or more invalid characters defined by the GetInvalidPathChars method. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// searchOption is not a valid SearchOption value. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path is invalid (for example, it is on an unmapped drive). 
        /// </para>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of type <see cref="DirectoryInfo"/> matching searchPattern.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IDirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption);

        /// <summary>
        /// <para>
        /// Returns an array of strongly typed <see cref="IFileSystemInfo"/> entries representing all the files and subdirectories in a directory.
        /// </para>
        /// </summary>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the DirectoryInfo object is invalid, such as being on an unmapped drive. 
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of strongly typed <see cref="IFileSystemInfo"/> entries.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IFileSystemInfo[] GetFileSystemInfos();

        /// <summary>
        /// <para>
        /// Retrieves an array of strongly typed <see cref="IFileSystemInfo"/> objects representing 
        /// the files and subdirectories that match the specified search criteria.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. For example, "System*" can be used to search for all directories that begin with the word "System".
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// searchPattern contains one or more invalid characters defined by the GetInvalidPathChars method. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path is invalid (for example, it is on an unmapped drive). 
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of strongly typed <see cref="IFileSystemInfo"/> objects matching the search criteria
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IFileSystemInfo[] GetFileSystemInfos(string searchPattern);

        /// <summary>
        /// <para>
        /// Retrieves an array of <see cref="IFileSystemInfo"/> objects that represent the files and subdirectories matching the specified search criteria.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. The default pattern is "*", which returns all files and directories.
        /// </para>
        /// </param>
        /// <param name="searchOption">
        /// <para>
        /// One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentException">
        /// <para>
        /// searchPattern contains one or more invalid characters defined by the GetInvalidPathChars method. 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// searchOption is not a valid SearchOption value. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path is invalid (for example, it is on an unmapped drive). 
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An array of file system entries that match the search criteria.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IFileSystemInfo[] GetFileSystemInfos(string searchPattern, SearchOption searchOption);

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of file information in the current directory.
        /// </para>
        /// </summary>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the <see cref="IFileInfo"/> object is invalid (for example, it is on an unmapped drive).  
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission. 
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of the files in the current directory.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IFileInfo> EnumerateFiles();

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of file information that matches a search pattern.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. The default pattern is "*", which returns all files.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the FileInfo object is invalid, (for example, it is on an unmapped drive).  
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of files that matches searchPattern.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IFileInfo> EnumerateFiles(string searchPattern);

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of file information that matches a specified search pattern and search subdirectory option.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. The default pattern is "*", which returns all files.
        /// </para>
        /// </param>
        /// <param name="searchOption">
        /// <para>
        /// One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is TopDirectoryOnly.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// searchOption is not a valid SearchOption value. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the FileInfo object is invalid (for example, it is on an unmapped drive).  
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of files that matches searchPattern and searchOption.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IFileInfo> EnumerateFiles(string searchPattern, SearchOption searchOption);

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of directory information in the current directory.
        /// </para>
        /// </summary>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the <see cref="IDirectoryInfo"/> object is invalid (for example, it is on an unmapped drive).  
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission. 
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of directories in the current directory.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IDirectoryInfo> EnumerateDirectories();

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of directory information that matches a specified search pattern.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. The default pattern is "*", which returns all files.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the DirectoryInfo object is invalid, (for example, it is on an unmapped drive).  
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of directories that matches searchPattern.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IDirectoryInfo> EnumerateDirectories(string searchPattern);

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. The default pattern is "*", which returns all files.
        /// </para>
        /// </param>
        /// <param name="searchOption">
        /// <para>
        /// One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is TopDirectoryOnly.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// searchOption is not a valid SearchOption value. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the DirectoryInfo object is invalid (for example, it is on an unmapped drive).   
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of directories that matches searchPattern and searchOption.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IDirectoryInfo> EnumerateDirectories(string searchPattern, SearchOption searchOption);

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of file system information in the current directory.
        /// </para>
        /// </summary>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the <see cref="IFileSystemInfo"/> object is invalid (for example, it is on an unmapped drive).   
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission. 
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of file system information in the current directory.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos();

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of file system information that matches a specified search pattern.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. The default pattern is "*", which returns all files.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the <see cref="IFileSystemInfo"/> object is invalid (for example, it is on an unmapped drive). 
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of file system information objects that matches searchPattern.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos(string searchPattern);

        /// <summary>
        /// <para>
        /// Returns an enumerable collection of file system information that matches a specified search pattern and search subdirectory option.
        /// </para>
        /// </summary>
        /// <param name="searchPattern">
        /// <para>
        /// The search string. The default pattern is "*", which returns all files.
        /// </para>
        /// </param>
        /// <param name="searchOption">
        /// <para>
        /// One of the enumeration values that specifies whether the search operation 
        /// should include only the current directory or all subdirectories. 
        /// The default value is TopDirectoryOnly.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para>
        /// searchPattern is a null reference (Nothing in Visual Basic). 
        /// </para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <para>
        /// searchOption is not a valid SearchOption value. 
        /// </para>
        /// </exception>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The path encapsulated in the <see cref="IFileSystemInfo"/> object is invalid (for example, it is on an unmapped drive).   
        /// </para>
        /// </exception>
        /// <exception cref="SecurityException">
        /// <para>
        /// The caller does not have the required permission.
        /// </para>
        /// </exception>
        /// <returns>
        /// <para>
        /// An enumerable collection of file system information objects that matches searchPattern and searchOption.
        /// </para>
        /// </returns>
        [SecuritySafeCritical]
        IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos(string searchPattern, SearchOption searchOption);

        /// <summary>
        /// Moves a DirectoryInfo instance and its contents to a new path.
        /// </summary>
        /// <param name="destDirName">
        /// The name and path to which to move this directory. 
        /// The destination cannot be another disk volume or a directory with the identical name. 
        /// It can be an existing directory to which you want to add this directory as a subdirectory.
        /// </param>
        [SecuritySafeCritical]
        void MoveTo(string destDirName);

        /// <summary>
        /// Deletes a file or directory.
        /// </summary>
        /// <param name="recursive">
        /// <para>
        /// true to delete this directory, its subdirectories, and all files; otherwise, false.
        /// </para>
        /// </param>
        /// <exception cref="IDirectoryNotFoundException">
        /// <para>
        /// The specified path is invalid; for example, it is on an unmapped drive. 
        /// </para>
        /// </exception>
        /// <exception cref="IIOException">
        /// <para>
        /// There is an open handle on the file or directory, and the operating system is Windows XP or earlier. 
        /// This open handle can result from enumerating directories and files. 
        /// For more information, see How to: Enumerate Directories and Files. 
        /// </para>
        /// </exception>
        [SecuritySafeCritical]
        void Delete(bool recursive);

        /// <summary>
        /// Returns a String
        /// </summary>
        /// <returns>A String</returns>
        string ToString();
    }
}